package com.caijg.controller.user;

import com.caijg.model.vo.resp.Result;
import com.caijg.model.vo.req.TongueDiagnosisReqVO;
import com.caijg.service.ITongueService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 * <p>
 * 舌诊表 前端控制器
 * </p>
 *
 * @author caijg
 * @since 2025-05-07
 */
@RestController
@RequestMapping("/user/tongue")
@RequiredArgsConstructor
@Tag(name = "舌诊模块")
@Slf4j
public class TongueController {

    private final ITongueService tongueService;

    @PostMapping("/diagnosis")
    @Operation(summary = "舌诊诊断")
    public Result diagnosis(@RequestBody TongueDiagnosisReqVO tongueDiagnosisReqVO) {
        log.info("舌诊诊断开始...");
        return tongueService.diagnosis(tongueDiagnosisReqVO);
    }


    @Operation(summary = "查询舌诊历史记录")
    @GetMapping("/history")
    public Result history() {
        log.info("用户舌诊历史查询...");
        return tongueService.history();
    }

    @Operation(summary = "删除舌诊历史记录")
    @PostMapping("/delete")
    public Result delete(@RequestBody ArrayList<String> ids) {
        log.info("删除舌诊记录：{}", ids);
        return tongueService.delete(ids);
    }

    @Operation(summary = "获取舌苔特征描述")
    @GetMapping("/{id}")
    public Result getById(@PathVariable Integer id) {
        return Result.success(tongueService.getById(id));
    }

}